"""
主页面路由
"""
from flask import render_template, redirect, url_for
from app.blueprints.main import main_bp


@main_bp.route('/')
def index():
    """首页"""
    return render_template('index.html')


@main_bp.route('/login')
def login_page():
    """登录页面"""
    return render_template('login.html')


@main_bp.route('/register')
def register_page():
    """注册页面"""
    return render_template('register.html')


@main_bp.route('/dashboard')
def dashboard():
    """仪表盘页面"""
    return render_template('dashboard.html')


@main_bp.route('/admin/dashboard')
def admin_dashboard():
    """管理员仪表盘"""
    return render_template('admin/dashboard.html')


@main_bp.route('/admin/users')
def admin_users():
    """用户管理页面"""
    return render_template('admin/users.html')


@main_bp.route('/admin/courses')
def admin_courses():
    """课程管理页面"""
    return render_template('admin/courses.html')


@main_bp.route('/admin/import')
def admin_import():
    """数据导入页面"""
    return render_template('admin/import.html')


@main_bp.route('/admin/settings')
def admin_settings():
    """系统设置页面"""
    return render_template('admin/settings.html')


@main_bp.route('/teacher/dashboard')
def teacher_dashboard():
    """教师仪表盘"""
    return render_template('teacher/dashboard.html')


@main_bp.route('/teacher/courses')
def teacher_courses():
    """我的课程页面"""
    return render_template('teacher/courses.html')


@main_bp.route('/teacher/students')
def teacher_students():
    """学生管理页面"""
    return render_template('teacher/students.html')


@main_bp.route('/teacher/course-edit')
def teacher_course_edit():
    """课程编辑页面"""
    return render_template('teacher/course_edit.html')


@main_bp.route('/student/dashboard')
def student_dashboard():
    """学生仪表盘"""
    return render_template('student/dashboard.html')


@main_bp.route('/student/courses')
def student_courses():
    """学生选课管理"""
    return render_template('student/courses.html')


@main_bp.route('/courses/<int:course_id>')
def course_detail_page(course_id):
    """课程详情页面（前端调用API加载数据）"""
    return render_template('course_detail.html', course_id=course_id)

